<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" >

  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" integrity="sha256-iM4Yzi/zLj/IshPWMC1IluRxTtRjMqjPGd97TZ9yYpU=" crossorigin="anonymous"></script>
  <link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Cousine|Inconsolata" rel="stylesheet">
  <link rel="shortcut icon" type="image/png" href="/favicon.png">

  <link rel="stylesheet" href="/css/style.css">
  <link rel="stylesheet" href="/css/css/fontawesome-all.min.css">
  <link rel="stylesheet" href="/css/css/work-sans-v7.css">
  <script src="/js/main.js"></script>

  <!-- Begin Jekyll SEO tag v2.6.1 -->
<title>JS: Get Posts | Hive Developer</title>
<meta name="generator" content="Jekyll v4.0.0" />
<meta property="og:title" content="JS: Get Posts" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Query for the most recent posts having a specific tag, using a Hive filter" />
<meta property="og:description" content="Query for the most recent posts having a specific tag, using a Hive filter" />
<link rel="canonical" href="get_posts.html" />
<meta property="og:url" content="get_posts.html" />
<meta property="og:site_name" content="Hive Developer" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2020-08-26T11:52:22-07:00" />
<script type="application/ld+json">
{"description":"Query for the most recent posts having a specific tag, using a Hive filter","mainEntityOfPage":{"@type":"WebPage","@id":"get_posts.html"},"@type":"BlogPosting","url":"get_posts.html","headline":"JS: Get Posts","dateModified":"2020-08-26T11:52:22-07:00","datePublished":"2020-08-26T11:52:22-07:00","@context":"https://schema.org"}</script>
<!-- End Jekyll SEO tag -->


  
</head>
<body>
<header>
  <h1>
    <button type="button" class="open-nav" id="open-nav"></button>
    <a href="/"  class="logo-link"><img src="/images/logotype_black.svg" height="40" alt="Hive Developer logo"></a>
  </h1>

  
  <form action="/search/" method="get">
    <input type="text" name="q" id="search-input" placeholder="Search">
    <input type="submit" value="Search" style="display: none;">
  </form>
  

  <div id="sidebar" class="sidebar">
	
	
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/">
		<h6 class="ctrl-nav-section title">Introduction</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/#introduction-welcome">Welcome to Hive</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/quickstart/">
		<h6 class="ctrl-nav-section title">Quickstart</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/quickstart/#quickstart-choose-library">Choose Library</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-hive-full-nodes">Hive Nodes</a></li>
						
					
						
						<li><a href="/quickstart/#quickstart-testnet">Hive Testnet</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/tutorials/">
		<h6 class="ctrl-nav-section title">Tutorials</h6>
		<ul class="cont-nav-section content">
			
				
					
						<li><a href="/tutorials/#tutorials-javascript">Javascript</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-python">Python</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-ruby">Ruby</a></li>
					
				
					
						<li><a href="/tutorials/#tutorials-recipes">Recipes</a></li>
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/services/">
		<h6 class="ctrl-nav-section title">Services</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/services/#services-hive-blog">hive.blog</a></li>
						
					
						
						<li><a href="/services/#services-hivesigner">HiveSigner</a></li>
						
					
						
						<li><a href="/services/#services-jussi">Jussi</a></li>
						
					
						
						<li><a href="/services/#services-imagehoster">ImageHoster</a></li>
						
					
						
						<li><a href="/services/#services-dhf">DHF</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/apidefinitions/">
		<h6 class="ctrl-nav-section title">Appbase API</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/apidefinitions/#apidefinitions-condenser-api">Condenser Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-bridge">Bridge</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-by-key-api">Account By Key Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-account-history-api">Account History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-block-api">Block Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-database-api">Database Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-debug-node-api">Debug Node Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-follow-api">Follow Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-jsonrpc">Jsonrpc</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-market-history-api">Market History Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-network-broadcast-api">Network Broadcast Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rc-api">Rc Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-reputation-api">Reputation Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-rewards-api">Rewards Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-tags-api">Tags Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-transaction-status-api">Transaction Status Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-witness-api">Witness Api</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops">Broadcast Ops</a></li>
						
					
						
						<li><a href="/apidefinitions/#apidefinitions-broadcast-ops-communities">Broadcast Ops Communities</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/resources/">
		<h6 class="ctrl-nav-section title">Resources</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/resources/#resources-overview">Overview</a></li>
						
					
						
						<li><a href="/resources/#resources-client-libs">Client Libraries</a></li>
						
					
						
						<li><a href="/resources/#resources-bluepaper">Bluepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-whitepaper">Whitepaper</a></li>
						
					
						
						<li><a href="/resources/#resources-tools">Tools</a></li>
						
					
						
						<li><a href="/resources/#resources-hivesigner-libs">Hivesigner Libs</a></li>
						
					
						
						<li><a href="/resources/#resources-hive-keychain">Hive Keychain</a></li>
						
					
						
						<li><a href="/resources/#resources-developeradvocate">Community & Help</a></li>
						
					
				
			
		</ul>
	</section>
	
		
    <section class="pnl-main-nav-section main-nav-section" url="/glossary/">
		<h6 class="ctrl-nav-section title">Glossary</h6>
		<ul class="cont-nav-section content">
			
				
					
					
						
						<li><a href="/glossary/#glossary-chain-basics">Chain Basics</a></li>
						
					
						
					
						
						<li><a href="/glossary/#glossary-governance">Governance</a></li>
						
					
						
						<li><a href="/glossary/#glossary-transactions">Transactions</a></li>
						
					
						
						<li><a href="/glossary/#glossary-api">API</a></li>
						
					
						
						<li><a href="/glossary/#glossary-market">Market</a></li>
						
					
				
			
		</ul>
	</section>
	
</div>



  <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
</header>
<div class="main" id="top">
  <div class="hero">
    <h1 class="hero__h1">Hive Developer Portal </h1>
    <img class="hero__img" src="/images/honey-comb-92.png" style="position: relative; top: 10px;" />
  </div>
  <section id="tutorials-javascript-get-posts" class="row tutorials-javascript-get-posts">
	<h3>
		<a id="tutorials-javascript-get-posts">
			JS: Get Posts
			
		</a>
	</h3>
	
		<span class="description"><p>Query for the most recent posts having a specific tag, using a Hive filter</p>
</span>
	

	<p>Full, runnable src of <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript/04_get_posts">Get Posts</a> can be downloaded as part of: <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript">tutorials/javascript</a> (or download just this tutorial: <a href="https://gitlab.syncad.com/hive/devportal/-/archive/master/devportal-master.zip?path=tutorials/javascript/04_get_posts">devportal-master-tutorials-javascript-04_get_posts.zip</a>).</p>

<p>This tutorial pulls a list of the posts from different tags or filters and displays them.
Tags and filters are different. It’s important to understand them.</p>

<h2 id="intro">Intro</h2>

<p>Tags &amp; Filters are two different.</p>

<p>A <code class="highlighter-rouge">tag</code> in Hive is much like a tag in Gmail, or Twitter. It’s a way to describe a
post as being relevant to a particular topic. Posts may have up to five tags on them, but there are limits when
querying (more on this later).</p>

<p>A <code class="highlighter-rouge">filter</code> in Hive is a kind of built-in ‘view’ or ordering of posts. You can use the following filters:
<code class="highlighter-rouge">trending</code>, <code class="highlighter-rouge">hot</code>, <code class="highlighter-rouge">new</code>, <code class="highlighter-rouge">active</code>, and <code class="highlighter-rouge">promoted</code>. You’ll get a feel for the subtleties of each as you create your
application.</p>

<h2 id="steps">Steps</h2>

<ol>
  <li><a href="#UI"><strong>UI</strong></a> - A brief description of the UI and inputting our query values</li>
  <li><a href="#Construct-query"><strong>Construct query</strong></a> - Assemble the information from the UI into our <code class="highlighter-rouge">filter</code> &amp; <code class="highlighter-rouge">query</code></li>
  <li><a href="#API-call"><strong>API call</strong></a> - Make the call to Hive</li>
  <li><a href="#Handle-response"><strong>Handle response</strong></a> - Accept the response in a promise callback, then render the results</li>
  <li><a href="#Example-post-object"><strong>Example post object</strong></a> - An example post object from the response list</li>
</ol>

<h4 id="1-ui-">1. UI <a name="UI"></a></h4>

<p>The source HTML for our UI can be found in <a href="https://gitlab.syncad.com/hive/devportal/-/tree/master/tutorials/javascript/04_get_posts/public/index.html">public/index.html</a></p>

<p>There are three input components to the UI.</p>

<ul>
  <li>
    <p>Filters: where we select one of the five built in filter types.</p>

    <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="nt">&lt;select</span> <span class="na">id=</span><span class="s">"filters"</span> <span class="na">class=</span><span class="s">"form-control"</span> <span class="nt">&gt;</span>...
</code></pre></div>    </div>
  </li>
  <li>
    <p>Tag: where we type in a <em>single</em>, arbitrary tag. (The Hive blockchain does not support searching on multiple tags)</p>

    <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="nt">&lt;input</span> <span class="na">id=</span><span class="s">"tag"</span> <span class="na">class=</span><span class="s">"form-control"</span><span class="nt">/&gt;</span>
</code></pre></div>    </div>
  </li>
  <li>
    <p>Get Posts: It’s a button. You click it, and we move on to assembling our post.</p>

    <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>  <span class="nt">&lt;button</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span> <span class="na">onclick=</span><span class="s">"getPosts()"</span><span class="nt">&gt;</span>Get Posts<span class="nt">&lt;/button&gt;</span>
</code></pre></div>    </div>
  </li>
</ul>

<center>
  <img src="https://gitlab.syncad.com/hive/devportal/-/raw/master/tutorials/javascript/04_get_posts/images/Step-01-UI.png" />
</center>

<h4 id="2-construct-query-">2. Construct query <a name="Construct-query"></a></h4>

<p>The filter and query are constructed within the async, globally available function <code class="highlighter-rouge">getPosts</code></p>

<p>The <code class="highlighter-rouge">limit</code> property you see below limits the total number of posts we’ll get back to something
managable. In this case, five.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">filter</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">filters</span><span class="dl">'</span><span class="p">).</span><span class="nx">value</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">query</span> <span class="o">=</span> <span class="p">{</span>
    <span class="na">tag</span><span class="p">:</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">tag</span><span class="dl">'</span><span class="p">).</span><span class="nx">value</span><span class="p">,</span>
    <span class="na">limit</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span>
<span class="p">};</span>
</code></pre></div></div>

<h4 id="3-api-call-">3. API call <a name="API-call"></a></h4>

<p>The api call itself is fairly simple. We use <code class="highlighter-rouge">getDiscussions</code>.
The first argument, filter, is a simple string.
The second argument is our query object.
Like most of dhive’s api functions, <code class="highlighter-rouge">getDiscussions</code> returns a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promise</a>.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">client</span><span class="p">.</span><span class="nx">database</span>
    <span class="p">.</span><span class="nx">getDiscussions</span><span class="p">(</span><span class="nx">filter</span><span class="p">,</span> <span class="nx">query</span><span class="p">)</span>
    <span class="p">.</span><span class="nx">th</span><span class="p">..</span>
</code></pre></div></div>

<h4 id="4-handle-response-">4. Handle response <a name="Handle-response"></a></h4>

<p>When the promise returned by <code class="highlighter-rouge">getDiscussions</code> completes successfully, the function we pass to <code class="highlighter-rouge">.then()</code>
iterates over the entries response, and constructs html from it.</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">...</span><span class="nx">ery</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">result</span> <span class="o">=&gt;</span> <span class="p">{</span>
            <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="dl">"</span><span class="s2">Response received:</span><span class="dl">"</span><span class="p">,</span> <span class="nx">result</span><span class="p">);</span>
            <span class="k">if</span> <span class="p">(</span><span class="nx">result</span><span class="p">)</span> <span class="p">{</span>
                <span class="kd">var</span> <span class="nx">posts</span> <span class="o">=</span> <span class="p">[];</span>
                <span class="nx">result</span><span class="p">.</span><span class="nx">forEach</span><span class="p">(</span><span class="nx">post</span> <span class="o">=&gt;</span> <span class="p">{</span>
                    <span class="kd">const</span> <span class="nx">json</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">post</span><span class="p">.</span><span class="nx">json_metadata</span><span class="p">);</span>
                    <span class="kd">const</span> <span class="nx">image</span> <span class="o">=</span> <span class="nx">json</span><span class="p">.</span><span class="nx">image</span> <span class="p">?</span> <span class="nx">json</span><span class="p">.</span><span class="nx">image</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="p">:</span> <span class="dl">''</span><span class="p">;</span>
                    <span class="kd">const</span> <span class="nx">title</span> <span class="o">=</span> <span class="nx">post</span><span class="p">.</span><span class="nx">title</span><span class="p">;</span>
                    <span class="kd">const</span> <span class="nx">author</span> <span class="o">=</span> <span class="nx">post</span><span class="p">.</span><span class="nx">author</span><span class="p">;</span>
                    <span class="kd">const</span> <span class="nx">created</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Date</span><span class="p">(</span><span class="nx">post</span><span class="p">.</span><span class="nx">created</span><span class="p">).</span><span class="nx">toDateString</span><span class="p">();</span>
                    <span class="nx">posts</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span>
                        <span class="s2">`&lt;div class="list-group-item"&gt;&lt;h4 class="list-group-item-heading"&gt;</span><span class="p">${</span><span class="nx">title</span><span class="p">}</span><span class="s2">&lt;/h4&gt;&lt;p&gt;by </span><span class="p">${</span><span class="nx">author</span><span class="p">}</span><span class="s2">&lt;/p&gt;&lt;center&gt;&lt;img src="</span><span class="p">${</span><span class="nx">image</span><span class="p">}</span><span class="s2">" class="img-responsive center-block" style="max-width: 450px"/&gt;&lt;/center&gt;&lt;p class="list-group-item-text text-right text-nowrap"&gt;</span><span class="p">${</span><span class="nx">created</span><span class="p">}</span><span class="s2">&lt;/p&gt;&lt;/div&gt;`</span>
                    <span class="p">);</span>
                <span class="p">});</span>

                <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">postList</span><span class="dl">'</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="nx">posts</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">''</span><span class="p">);</span>
            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
                <span class="nb">document</span><span class="p">.</span><span class="nx">getElementById</span><span class="p">(</span><span class="dl">'</span><span class="s1">postList</span><span class="dl">'</span><span class="p">).</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">No result.</span><span class="dl">"</span><span class="p">;</span>
            <span class="p">}</span>
        <span class="p">})</span>
</code></pre></div></div>

<h4 id="5-example-post-object-">5. Example post object <a name="Example-post-object"></a></h4>

<p>The result returned from the service is a <code class="highlighter-rouge">JSON</code> list. This is an example list with one entry.</p>

<div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">[</span><span class="w">
  </span><span class="p">{</span><span class="w">
    </span><span class="nl">"abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"active"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2020-04-29T06:08:18"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"active_votes"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"allow_curation_rewards"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
    </span><span class="nl">"allow_replies"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
    </span><span class="nl">"allow_votes"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
    </span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hiveio"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"author_reputation"</span><span class="p">:</span><span class="w"> </span><span class="s2">"34879294456530"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"author_rewards"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"beneficiaries"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"body"</span><span class="p">:</span><span class="w"> </span><span class="s2">"![#HuobiHive2020 ... an asset shining bright, provided by community member @nateaguila](https://files.peakd.com/file/peakd-hive/hiveio/XsnzlWHl-social_hive_flare.jpg)</span><span class="se">\n\n</span><span class="s2">## Huobi has listed Hive! ..."</span><span class="p">,</span><span class="w">
    </span><span class="nl">"body_length"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1969-12-31T23:59:59"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"category"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hiveblockchain"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"children"</span><span class="p">:</span><span class="w"> </span><span class="mi">26</span><span class="p">,</span><span class="w">
    </span><span class="nl">"children_abs_rshares"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"created"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2020-04-24T00:41:06"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"curator_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"depth"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">85763874</span><span class="p">,</span><span class="w">
    </span><span class="nl">"json_metadata"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
      </span><span class="nl">"app"</span><span class="p">:</span><span class="w"> </span><span class="s2">"peakd/2020.04.4"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"format"</span><span class="p">:</span><span class="w"> </span><span class="s2">"markdown"</span><span class="p">,</span><span class="w">
      </span><span class="nl">"description"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Hive is now listed on Huobi Global! This post contains all official links and AMA transcripts."</span><span class="p">,</span><span class="w">
      </span><span class="nl">"tags"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
        </span><span class="s2">"hiveblockchain"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"exchangenews"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"hiveama"</span><span class="w">
      </span><span class="p">],</span><span class="w">
      </span><span class="nl">"users"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
        </span><span class="s2">"nateaguila"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"roelandp"</span><span class="w">
      </span><span class="p">],</span><span class="w">
      </span><span class="nl">"links"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
        </span><span class="s2">"/trending/huobihive2020"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"/@nateaguila"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://twitter.com/HuobiGlobal/status/1253210569194090497"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://huobiglobal.zendesk.com/hc/en-us/articles/900000684263"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://huobiglobal.zendesk.com/hc/en-us/articles/900000687166--EXCLUSIVE-Deposit-HIVE-on-Huobi-Global-to-Share-100-000-HIVE-"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://twitter.com/HuobiGlobal/status/1252566140431130624"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"/@roelandp"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"/trending/notfinancialadvice"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://developers.hive.io/"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://hiveprojects.io/"</span><span class="w">
      </span><span class="p">],</span><span class="w">
      </span><span class="nl">"image"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
        </span><span class="s2">"https://files.peakd.com/file/peakd-hive/hiveio/XsnzlWHl-social_hive_flare.jpg"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://files.peakd.com/file/peakd-hive/hiveio/9tEYm2I9-image.png"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://files.peakd.com/file/peakd-hive/hiveio/AXkoBSE3-image.png"</span><span class="p">,</span><span class="w">
        </span><span class="s2">"https://files.peakd.com/file/peakd-hive/hiveio/djdRACpx-image.png"</span><span class="w">
      </span><span class="p">]</span><span class="w">
    </span><span class="p">},</span><span class="w">
    </span><span class="nl">"last_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2020-05-01T00:41:06"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"last_update"</span><span class="p">:</span><span class="w"> </span><span class="s2">"2020-04-24T00:41:06"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_accepted_payout"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"max_cashout_time"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1969-12-31T23:59:59"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"net_rshares"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"net_votes"</span><span class="p">:</span><span class="w"> </span><span class="mi">182</span><span class="p">,</span><span class="w">
    </span><span class="nl">"parent_author"</span><span class="p">:</span><span class="w"> </span><span class="s2">""</span><span class="p">,</span><span class="w">
    </span><span class="nl">"parent_permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hiveblockchain"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"percent_steem_dollars"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
    </span><span class="nl">"permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"huobi-global-official-hive-listing-announcement-giveaways-ama-chat-transcripts"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"promoted"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"reblogged_by"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"replies"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
    </span><span class="nl">"reward_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">10000</span><span class="p">,</span><span class="w">
    </span><span class="nl">"root_author"</span><span class="p">:</span><span class="w"> </span><span class="s2">"hiveio"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"root_permlink"</span><span class="p">:</span><span class="w"> </span><span class="s2">"huobi-global-official-hive-listing-announcement-giveaways-ama-chat-transcripts"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"root_title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Huobi Global Official Hive Listing Announcement, Giveaways, and AMA Chat Transcripts"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"title"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Huobi Global Official Hive Listing Announcement, Giveaways, and AMA Chat Transcripts"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_pending_payout_value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.000 HBD"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"total_vote_weight"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
    </span><span class="nl">"url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/hiveblockchain/@hiveio/huobi-global-official-hive-listing-announcement-giveaways-ama-chat-transcripts"</span><span class="p">,</span><span class="w">
    </span><span class="nl">"vote_rshares"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="w">
  </span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div></div>

<p><strong>And that’s all there is to getting top-level posts.</strong> <em>See <a href="get_post_comments.html">Get post comments</a> for getting comments</em></p>

<h3 id="to-run-the-tutorial">To Run the tutorial</h3>

<ol>
  <li><code class="highlighter-rouge">git clone https://gitlab.syncad.com/hive/devportal.git</code></li>
  <li><code class="highlighter-rouge">cd devportal/tutorials/javascript/04_get_posts</code></li>
  <li><code class="highlighter-rouge">npm i</code></li>
  <li><code class="highlighter-rouge">npm run dev-server</code> or <code class="highlighter-rouge">npm run start</code></li>
  <li>After a few moments, the server should be running at <a href="http://localhost:3000/">http://localhost:3000/</a></li>
</ol>

<hr />

</section>

</div>
<div class="footer">
  <a href="#">Back to top</a>
</div>
<script>
    document.getElementById("open-nav").addEventListener("click", function () {
        document.body.classList.toggle("nav-open");
    });
</script>
</body>
</html>


<script src="/js/adjust.js"></script>

